/*
 *  SyncIT , easy synchronization of files between computers and devices.
 *  Copyright (C) 2011  Christian Masus <cmasus(at)gmail.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version. If redistributing and/or modifying
 *  this file, this notice must be included in the redistributed or
 *  modified copy.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package gui.javagui;

import java.awt.Font;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

@SuppressWarnings("serial")
public class MainMenuBar extends JMenuBar {

	private GuiActions guiActions;
	private Font font;

	public MainMenuBar(GuiActions guiActions) {
		this.guiActions = guiActions;

		font = getFont();
		font = font.deriveFont(Font.PLAIN);

		init();
	}

	private void init() {
		JMenu fileMenu = new JMenu("File");
		fileMenu.setFont(font);
		fileMenu.setMnemonic(KeyEvent.VK_F);

		JMenuItem addMenuItem = new JMenuItem(guiActions.getAddAction());
		addMenuItem.setFont(font);
		addMenuItem.setIcon(null);

		JMenuItem removeMenuItem = new JMenuItem(guiActions.getRemoveAction());
		removeMenuItem.setFont(font);
		removeMenuItem.setIcon(null);

		JMenuItem exitMenuItem = new JMenuItem(guiActions.getExitAction());
		exitMenuItem.setFont(font);
		exitMenuItem.setIcon(null);


		JMenu optionsMenu = new JMenu("Options");
		optionsMenu.setFont(font);
		optionsMenu.setMnemonic(KeyEvent.VK_O);

		JMenuItem startMenuItem = new JMenuItem(guiActions.getStartAction());
		startMenuItem.setFont(font);
		startMenuItem.setIcon(null);

		JMenuItem pauseMenuItem = new JMenuItem(guiActions.getPauseAction());
		pauseMenuItem.setFont(font);
		pauseMenuItem.setIcon(null);

		JMenuItem stopMenuItem = new JMenuItem(guiActions.getStopAction());
		stopMenuItem.setFont(font);
		stopMenuItem.setIcon(null);

		JMenuItem preferencesMenuItem = new JMenuItem(guiActions.getPreferencesAction());
		preferencesMenuItem.setFont(font);
		preferencesMenuItem.setIcon(null);


		JMenu helpMenu = new JMenu("Help");
		helpMenu.setFont(font);
		helpMenu.setMnemonic(KeyEvent.VK_H);

		JMenuItem helpMenuItem = new JMenuItem(guiActions.getHelpAction());
		helpMenuItem.setFont(font);
		helpMenuItem.setIcon(null);

		JMenuItem webpageMenuItem = new JMenuItem(guiActions.getWebpageAction());
		webpageMenuItem.setFont(font);
		webpageMenuItem.setIcon(null);

		JMenuItem whatismyipMenuItem = new JMenuItem(guiActions.getWhatIsMyIPAction());
		whatismyipMenuItem.setFont(font);
		whatismyipMenuItem.setIcon(null);

		JMenuItem checkforUpdatesMenuItem = new JMenuItem(guiActions.getCheckforUpdatesAction());
		checkforUpdatesMenuItem.setFont(font);
		checkforUpdatesMenuItem.setIcon(null);

		JMenuItem aboutMenuItem = new JMenuItem(guiActions.getAboutAction());
		aboutMenuItem.setFont(font);
		aboutMenuItem.setIcon(null);



		fileMenu.add(addMenuItem);
		fileMenu.add(removeMenuItem);
		fileMenu.addSeparator();
		fileMenu.add(exitMenuItem);

		optionsMenu.add(startMenuItem);
		optionsMenu.add(pauseMenuItem);
		optionsMenu.add(stopMenuItem);
		optionsMenu.addSeparator();
		optionsMenu.add(preferencesMenuItem);

		helpMenu.add(helpMenuItem);
		helpMenu.add(webpageMenuItem);
		helpMenu.addSeparator();
		helpMenu.add(whatismyipMenuItem);
		helpMenu.addSeparator();
		helpMenu.add(checkforUpdatesMenuItem);
		helpMenu.addSeparator();
		helpMenu.add(aboutMenuItem);

		add(fileMenu);
		add(optionsMenu);
		add(helpMenu);
	}

}
